package io.adrainty.bolee.framework.feign.interceptor;

import feign.RequestInterceptor;
import feign.RequestTemplate;
import io.adrainty.bolee.framework.commons.constants.GlobalOauth2Constants;
import io.adrainty.bolee.framework.commons.user.SubjectContentUtil;
import org.apache.commons.lang3.StringUtils;

/**
 * @author AdRainty
 * @version V1.0.0
 * @since 2025/7/27 下午11:23
 */

public class FeignAuthInterceptor implements RequestInterceptor {

    @Override
    public void apply(RequestTemplate template) {
        String userToken = SubjectContentUtil.getUserToken();
        if (StringUtils.isNotBlank(userToken)) {
            template.header(GlobalOauth2Constants.USER_TOKEN, userToken);
        }
    }

}
